<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        html{
            color: #fff;
            font-size: 14px;
        }
        .container{
            text-align: center;
            width: 100%;
            max-width: 960px;
            margin: 0 auto;
            padding: 15px 5px;
            background-color: rgba(0,0,0,0.3);
            height: 100%;
            position: absolute;
        }
        .hongbao{
            height: 450px;
            background: #A5423A;
            width: 300px;
            left: 0;
            top: 0;
            border-radius: 10px;
            margin: 0 auto;
        }
        .topcontent{
            height: 280px;
            border: 1px solid #BD503A;
            background-color: #BD503A;
            border-radius: 10px 10px 50% 50% / 10px 10px 15% 15%;
            box-shadow: 0px 4px 0px -1px rgba(0,0,0,0.2);
        }
        .avatar{
            position: relative;
        }
        .avatar span{
            position: absolute;
            top: 10px;
            right: 15px;
            -webkit-transform: rotate(45deg);
            -ms-transform: rotate(45deg);
            transform: rotate(45deg);
            font-size: 2em;
            font-weight: bolder;
        }
        #close{
            color: rgba(0,0,0,0.5);
        }
        .avatar img{
            border: 1px solid #BD503A;
            border-radius: 50%;
            overflow: hidden;
            margin-top: 10%;
        }
        .topcontent h2{
            margin: 15px 0;
        }
        .text{
            color: #ccc;
        }
        .description{
            margin: 15px 0;
            font-size: 16px;
            font-weight: 600;
        }
        #chai{
            width: 100px;
            height: 100px;
            border: 1px solid #FFA73A;
            background-color: #FFA73A;
            border-radius: 50%;
            color: #000;
            font-size: 40px;
            display: inline-block;
            margin-top: -50px;
            box-shadow: 0px 4px 0px 0px rgba(0, 0, 0, 0.2);
        }
        #chai span{
            margin-top: 27px;
            display: inline-block;
            font-weight: bold;
        }
        .rotate{
            -webkit-animation: anim .6s infinite alternate;
            -ms-animation: anim .6s infinite alternate;
            animation: anim .6s infinite alternate;
        }
        @-webkit-keyframes anim {
            from { -webkit-transform: rotateY(180deg); }
            to { -webkit-transform: rotateY(360deg); }
        }
        @-ms-keyframes anim {
            from { -ms-transform: rotateY(180deg); }
            to { -ms-transform: rotateY(360deg); }
        }
        @keyframes anim {
            from { transform: rotateY(180deg); }
            to { transform: rotateY(360deg); }
        }
        .d1{
            width: 100px;
            height: 100px;
            margin: 50px;
            border: 2px solid #f00;
            border-radius: 10px 10px 50% 50% / 10px 10px 15% 15%;;
        }
    </style>
</head>
<body>
    <div class="container" id="container">
        <div class="hongbao">
            <div class="topcontent">
                <div class="avatar">
                    <img src="header-img.jpg" alt="" width="80" height="80">
                    <span id="close">+</span>
                </div>
                <h2>Youngwell</h2>
                <span class="text">给你发了一个红包</span>
                <div class="description">恭喜发财 大吉大利</div>
            </div>
            <div class="chai" id="chai">
                <span>開</span>
            </div>
        </div>

        <div class="d1"></div>
    </div>
    <script>
        var oChai = document.getElementById("chai");
        var oClose = document.getElementById("close");
        var oContainer = document.getElementById("container");

        oChai.onclick = function (){
            oChai.setAttribute("class", "rotate");
        }
        oClose.onclick = function (){
            oContainer.style.display = "none";
        }
    </script>
</body>
</html>